package com.bjpowerndoe.ylb.web.settings;

import io.swagger.annotations.Api;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.w3c.dom.DocumentType;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.DocumentationCache;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration(proxyBeanMethods = false)
public class SwaggerSettings {
    //创建Docket对象
    @Bean

    public Docket docket(){
        Docket docket =new Docket(DocumentationType.SWAGGER_2);
        //设置Api基本信息
        ApiInfo apiInfo = new ApiInfoBuilder().title("北京2217班级的盈利宝")
                .version("1.0")
                .description("SpringBoot + Vue 前后端分离的互联网项目")
                .contact(new Contact("BJ2217","http://www.bjpowernode.com","bj@node.com"))
                .license("Apache2.0")
                .build();
        docket = docket.apiInfo(apiInfo);

        //指定参与文档生成的类
        docket = docket.select().apis(RequestHandlerSelectors.basePackage("com.bjpowerndoe.ylb.web.controller")).build();
        //不渲染文档
        //docket = docket.enable(false);
        return docket;
    }
}
